fix(python): trim Layer.source redaction cost and document save_project - #1772
Conversation
- Sweep only the source field in Layer.source. redact_layer copied an inlined geojson blob first and then discarded it, which .data pays for deliberately but .source has no reason to. - Document that the top-level save_project writes verbatim, credentials included, and why: it is the lossless primitive the MCP server round-trips a user's own file through, where redacting on every edit would strip their own API keys. Point at Map.save_project and redact_credentials for the sharing case. - Sync docs/python.md's Map API table with the methods this PR adds; it had drifted from the expanded table in python/README.md.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe PR adds field-level credential redaction for layer values. It updates ChangesCredential Redaction and API Documentation
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔍 Cloudflare PR preview
|
Code reviewI reviewed the diff (docs/python.md, python/README.md, python/src/geolibre/{authoring.py, geolibre.py, project.py}) against the surrounding source, including Bugs: None found. Security: No change in redaction coverage — Performance: The stated goal (avoid deep-copying the whole layer, including a potentially large inlined GeoJSON blob, just to read Quality: All new/edited docstrings (authoring.py CLAUDE.md: No applicable guidelines are implicated (change is confined to the Python package and docs, not the JS workspaces/Whitebox catalog/CSP/i18n areas CLAUDE.md calls out). Confidence: high. No inline comments posted — nothing rose to a level warranting one. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/python.md`:
- Line 260: Update the remove_layer entry in the API table to use the parameter
name layer instead of layer_id, matching its supported ID, name, and Layer
handle selectors; leave clear_layers() and the description unchanged.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 4cc43821-3bfd-4f10-95e6-f64186ec6d2f
📒 Files selected for processing (5)
docs/python.mdpython/README.mdpython/src/geolibre/authoring.pypython/src/geolibre/geolibre.pypython/src/geolibre/project.py
🔍 GitHub Pages PR preview
Note GitHub Pages built this preview successfully, but its serving edge returned HTTP 403 when checked. The links may still be propagating. |
Fix the remove_layer row in python/README.md rather than docs/python.md. The two tables disagreed and the README was the wrong one: the parameter is `layer_id`, so `remove_layer(layer=...)` raises TypeError. Both now match the signature, and the description already says it accepts an id, name, or handle.
|
All accurate. Everything checks out: the I found no bugs, security issues, or CLAUDE.md violations worth flagging as inline comments — this is a small, low-risk refactor + docs PR. Code reviewBugs: None found. Security: None found. Credential sweeping still goes through the same Performance: The stated goal is met — Quality: Small, well-scoped change with a clear docstring explaining why the new helper exists; existing test ( CLAUDE.md: N/A — this PR touches only |
Summary
Follow-up to #1770, which merged while the last round of review comments was still being addressed. Three items from that round:
Layer.sourcewent throughproject.redact_layer, which deep-copies the whole layer record, including an inlined GeoJSON blob, only to keep the smallsourcesub-object. It now sweeps just that field via a newproject.redact_layer_field.Layer.datastill copies the record whole, which is what it is for and is documented as such.geolibre.save_projectwrites verbatim, credentials included, whileMap.save_projectredacts by default. That is deliberate, since the MCP server round-trips a user's own project file through it and redacting on every edit would strip their own API keys, but nothing said so. Documented on the function and in the README, pointing atMap.save_projectandredact_credentialsfor the sharing case.docs/python.md's Map API table still listed only the pre-feat(python): expand layer management and headless camera API #1770 methods, so it had drifted from the expanded table inpython/README.md. Synced.Test plan
cd python && pytest(314 passed, 3 skipped, with themcpextra installed)ruff checkandruff format --checkclean overpython/src/geolibre/Summary by CodeRabbit
remove_layerparameter name.